﻿@using MvcPaging
@model IPagedList<Classified.Domain.Entities.ClassifiedAd>
<div id="dvOrders">
    <table class="table table-bordered table-striped">
        <thead>
            <th>
                Name
            </th>
            <th>
                Category Name
            </th>
            <th>
                Location Name
            </th>
            <th width="8%">
                Created On
            </th>
            <th width="4%">
                Active
            </th>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ClassifiedCategories.Name)
                </td>
                <td>
                    @{
            int i = 0;
                    }
                    @foreach (var l in item.Locations)
                    {

                        if (i > 0)
                        {
                        <text>,</text>
                        }
                        i++;
                        @Html.DisplayFor(modelItem => l.Name)
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreatedOnUtc)
                </td>
                <td>
                    @item.IsActive
                </td>
            </tr>
        }
    </table>
 
    @if (Model.TotalItemCount > 0)
{
    <div class="pagingContainer noprint">
        @Ajax.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount, new AjaxOptions { UpdateTargetId = "dvOrders" })
    </div>
}
</div>
